using System.Collections.Generic;
using System.Linq;
using CxRomos.Core.Domain;
using CxRomos.Core.Domain.Entities;
using StructureMap;

namespace CxRomos.Core.DataAccess.Implementation {
    [Pluggable("Default")]
    public class PersonRepository : RepositoryBase, IPersonRepository {
        public IList<Person> GetAll() {
            var persons = (from p in Context.Persons
                           select p).ToList();

            return persons;
        }

        public Person GetById(int personId) {
            var person = (from p in Context.Persons
                          where p.PersonId == personId
                          select p).SingleOrDefault();

            return person;
        }
    }
}